<?php

declare(strict_types=1);

namespace SixShop\Wangdian\DTO\Trade;

/**
 * Trade order DTO
 */
readonly class TradeOrder
{
    public function __construct(
        public string $tid,
        public int $tradeStatus,
        public int $deliveryTerm,
        public int $payStatus,
        public string $tradeTime,
        public string $payTime,
        public string $buyerNick,
        public string $buyerEmail,
        public string $receiverMobile,
        public string $receiverName,
        public string $receiverProvince,
        public string $receiverCity,
        public string $receiverDistrict,
        public string $receiverAddress,
        public int $logisticsType,
        public float $postAmount,
        public float $paid,
        public array $orderList,
        public ?string $receiverTelno = null,
        public ?string $receiverZip = null,
        public ?int $invoiceType = null,
        public ?string $invoiceTitle = null,
        public ?string $invoiceContent = null,
        public ?string $buyerMessage = null,
        public ?string $custData = null,
        public ?string $remark = null,
        public ?int $remarkFlag = null,
        public ?float $codAmount = null,
        public ?float $extCodFee = null,
    ) {
    }

    public function toArray(): array
    {
        return [
            'tid' => $this->tid,
            'trade_status' => $this->tradeStatus,
            'delivery_term' => $this->deliveryTerm,
            'pay_status' => $this->payStatus,
            'trade_time' => $this->tradeTime,
            'pay_time' => $this->payTime,
            'buyer_nick' => $this->buyerNick,
            'buyer_email' => $this->buyerEmail,
            'receiver_mobile' => $this->receiverMobile,
            'receiver_telno' => $this->receiverTelno,
            'receiver_zip' => $this->receiverZip,
            'receiver_province' => $this->receiverProvince,
            'receiver_name' => $this->receiverName,
            'receiver_city' => $this->receiverCity,
            'receiver_district' => $this->receiverDistrict,
            'receiver_address' => $this->receiverAddress,
            'logistics_type' => $this->logisticsType,
            'invoice_type' => $this->invoiceType,
            'invoice_title' => $this->invoiceTitle,
            'invoice_content' => $this->invoiceContent,
            'buyer_message' => $this->buyerMessage,
            'cust_data' => $this->custData,
            'remark' => $this->remark,
            'remark_flag' => $this->remarkFlag,
            'post_amount' => $this->postAmount,
            'paid' => $this->paid,
            'cod_amount' => $this->codAmount,
            'ext_cod_fee' => $this->extCodFee,
            'order_list' => $this->orderList,
        ];
    }
}